//
//  GHChongZhiRecordCell.m
//  GodHorses
//
//  Created by Mac on 2017/11/16.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "GHConsumeTableViewCell.h"
@interface GHConsumeTableViewCell()
@property(nonatomic, strong) STButton                     *nameButton;
@property(nonatomic, strong) STLabel                      *timeLable;//时间
@property(nonatomic, strong) STLabel                      *moneyLable;
@end
@implementation GHConsumeTableViewCell

+ (CGFloat)CellHeight{
    return 70;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
#pragma mark --subView
- (void)configSubView{
    self.backgroundColor = [UIColor whiteColor];
    
    self.nameButton = [[STButton alloc] initWithFrame:CGRectMake(15, 10, UIScreenWidth - 220, 20)
                                                  title:@"--"
                                             titleColor:GH_firstTextColor
                                              titleFont:15
                                           cornerRadius:0
                                        backgroundColor:nil
                                        backgroundImage:nil
                                                  image:[UIImage imageNamed:@"PC_zhanghumingxi"]];
    self.nameButton.titleEdgeInsets = UIEdgeInsetsMake(0, 8, 0, 0);
    [self addSubview:self.nameButton];
    
    
    self.moneyLable = [[STLabel alloc] initWithFrame:CGRectMake(0, 16, 200, 20)
                                                 text:@"---"
                                            textColor:GH_YellowBackGroundColor
                                                 font:18
                                          isSizetoFit:NO
                                        textAlignment:NSTextAlignmentRight];
    self.moneyLable.st_right = UIScreenWidth - 15;
    self.moneyLable.st_centerY = [GHConsumeTableViewCell CellHeight]/2;
    [self addSubview:self.moneyLable];
    
    self.timeLable = [[STLabel alloc] initWithFrame:CGRectMake(0, _nameButton.st_bottom + 13, 300, 15)
                                               text:@"2017-09-21 13:21:05"
                                          textColor:GH_secendTextColor
                                               font:13
                                        isSizetoFit:NO
                                      textAlignment:NSTextAlignmentLeft];
    self.timeLable.left = self.nameButton.left + self.nameButton.imageView.size.width + 8;
    [self addSubview:self.timeLable];
    
    //line
    UIView * line = [[UIView alloc] initWithFrame:CGRectMake(0, [GHConsumeTableViewCell CellHeight] - 1, UIScreenWidth, 0.5)];
    line.backgroundColor = GH_lineColor;
    [self addSubview:line];

}
- (void)setModel:(GHConsumeModel *)model{
    _model = model;
    [self.nameButton setTitle:model.g_name forState:UIControlStateNormal] ;
    
    NSDate * date = [NSDate dateWithTimeIntervalSince1970:[model.add_time integerValue]].st_localDate;
    
    self.timeLable.text = [NSString stringWithFormat:@"%@(%@)",date.st_yyyyMMddhhmmssWithDate,model.typeStr];
    
    self.moneyLable.text = model.order_amount;
}

@end


